// UDP Test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Server.h"

DWORD WINAPI ServerStart(LPVOID param)
{
  Server* server = reinterpret_cast<Server*>(param);

  server->Listen("127.0.0.1", 5000);

  return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
  _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

  Server* server = new Server();

  HANDLE t = CreateThread(NULL, 0, ServerStart, server, 0, 0);

  while ( 1 )
  {
    if (_kbhit())
      break;

    Sleep(16);
  }

  server->Shutdown();

  WaitForSingleObject(t, INFINITE);
  CloseHandle(t);

  delete server;

  return 0;
}

